#pragma warning disable 0618
using System;
using System.Collections.Generic;
using Table.DataModel;
namespace Table.Dao
{
    public class TableSailorModelTransDao:DaoBase<TableSailorModelTrans>
    {
        public override string GetFileName()
        {
            return "TableSailorModelTrans.csv";
        }
        public override void BuildIndex()
        {
            if (cacheList != null)
            {
                cachePrimaryInt = new Dictionary<int, TableSailorModelTrans>(cacheList.Count);
            }
            base.BuildIndex();
        }
        public override void AddOneIndex(TableSailorModelTrans model)
        {
            if (!cacheOneIndex.ContainsKey(model.SMTId.ToString()))
            {
                cacheOneIndex[model.SMTId.ToString()] = new List<TableSailorModelTrans>();
            }
            cacheOneIndex[model.SMTId.ToString()].Add(model);
        }
        public override void AddPrimaryIndex(TableSailorModelTrans model)
        {
            #if UNITY_EDITOR
            if(cachePrimaryInt.ContainsKey(model.SMTIId)) UnityEngine.Debug.LogError("数据表id重复:TableSailorModelTrans->id: " + model.SMTIId);
            #endif
            cachePrimaryInt[model.SMTIId] = model;
        }
        protected override TableSailorModelTrans ParseRowData(string[] rowData)
        {
            TableSailorModelTrans data = new TableSailorModelTrans();
            if (!string.IsNullOrEmpty(rowData[0]))
            {
                data.SMTIId = int.Parse(rowData[0]);
            }
            if (!string.IsNullOrEmpty(rowData[1]))
            {
                data.SMTId = int.Parse(rowData[1]);
            }
            if (!string.IsNullOrEmpty(rowData[2]))
            {
                data.Weight = int.Parse(rowData[2]);
            }
            if (!string.IsNullOrEmpty(rowData[3]))
            {
                data.FromMAId = int.Parse(rowData[3]);
            }
            if (!string.IsNullOrEmpty(rowData[4]))
            {
                data.ToMAId = int.Parse(rowData[4]);
            }
            if (!string.IsNullOrEmpty(rowData[5]))
            {
                data.TransTimer = double.Parse(rowData[5]);
            }
            if (!string.IsNullOrEmpty(rowData[6]))
            {
                data.TransDuration = double.Parse(rowData[6]);
            }
            if (!string.IsNullOrEmpty(rowData[7]))
            {
                data.TransProcessType = int.Parse(rowData[7]);
            }
            if (!string.IsNullOrEmpty(rowData[8]))
            {
                data.TransProcessArgs = string.Intern(rowData[8]);
            }
            return data;
        }
    }
}
